package com.testmanager.testmananger.user.constants;

import com.testmanager.testmananger.foundation.domain.enums.EnumBase;

import java.util.Arrays;

public enum UserJobType implements EnumBase {
    DEMANDOR("产品",0),
    DEVELOPER("开发",1),
    TESTER("测试",2)
    ;
    public static final String CODE = "user_job_type";
    private final String name;
    private final Integer value;

     UserJobType(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    public static UserJobType getValueOf(Integer value){

        return Arrays.stream(UserJobType.values())
                .filter(t->t.getValue().equals(value))
                .findFirst()
                .orElse(UserJobType.DEMANDOR);
    }



    @Override
    public String getName() {
        return name;
    }

    @Override
    public Integer getValue() {
        return value;
    }
}
